//
//  MyOrderController.m
//  Learn
//
//  Created by zyl on 2024/4/2.
//  Copyright © 2024 迟建国. All rights reserved.
//

#import "MyOrderController.h"
#import "MyOrderTableViewCell.h"
#import "MineAPIManager.h"
@interface MyOrderController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic ,strong)UITableView *tableView;

@property(nonatomic ,strong)NSArray *dataArray;

@end

@implementation MyOrderController
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self renderNavBarWithBackgroundImage:[UIImage imageWithColor:lClearColor] backgroundColor:lClearColor shadowColor:nil textAttributeDic:@{NSForegroundColorAttributeName:rgba(51, 51, 51, 1),NSFontAttributeName:MFontWithSize(18)} enableScrollEdgeAppearance:NO];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的订单";
    // Do any additional setup after loading the view.
    [self setBackButtonIsHidden:NO];
    [self.view addSubview:self.tableView];
    self.view.backgroundColor = rgba(245, 245, 245, 1);
   
    [MineAPIManager GetMyOrderListWithParam:@{} result:^(NSDictionary * _Nonnull dic) {
        NSLog(@"UUUUUUUUUUUU%@",[dic modelToJSONString]);
    }];
    
}

#pragma mark -UITableViewDelegate,UITableViewDelegate
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MyOrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"VipCenterTableViewCell"];
    
    if (!cell)
    {
        cell = [[MyOrderTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"VipCenterTableViewCell"];
        cell.selectionStyle =UITableViewCellSelectionStyleNone;
    }
  //  cell.data = self.dataArray[indexPath.row];
    return cell;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.dataArray.count;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 104;
    
}
//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
//{
//    return 32;
//}
//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
//{
//    UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, lScreenWidth,32)];
//    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, lScreenWidth - 20, 22)];
//    titleLabel.font = MFontWithSize(16);
//    titleLabel.text = @"精选书籍";
//    [titleLabel setTextAlignment:NSTextAlignmentLeft];
//    titleLabel.textColor = rgba(51, 51, 51, 1);
//    [header addSubview:titleLabel];
//    return header;
//}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//    UIViewController *vc= [[UIViewController alloc] initWithClassName:@"BookDetailViewController"];
//    vc.paraObject = self.dataArray[indexPath.row];
//    [self.navigationController pushViewController:vc animated:YES];
    
}
#pragma mark -getters and setters
-(UITableView *)tableView{
    if (!_tableView){
        _tableView =[[UITableView alloc] initWithFrame:CGRectMake(0, lTopBarHeight, lScreenWidth, lScreenHeight - lTopBarHeight) style:UITableViewStylePlain];
        [_tableView setDelegate:self];
        [_tableView setDataSource:self];
        _tableView.bounces = NO;
        [_tableView setBackgroundColor:lClearColor];
        [_tableView setSeparatorColor:lClearColor];
        [_tableView setSeparatorInset:UIEdgeInsetsMake(0, 10, 0, 0)];
    }
    
    return _tableView;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
